<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>axios发送并发请求</title>
    <!--引入axios-->
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

    <script>
        function findAll() {
            return axios.get("http://localhost:8989/axios/user/findAll?username=夏普&password=789789")
        }
        function save() {
            return axios.post("http://localhost:8989/axios/user/save",{username:'奔驰',password:'456456'})
        }
        // 用all来发送多个请求，用spread来接受参数
        axios.all([findAll(),save()])
            .then(axios.spread(function (result1,result2) {
            console.log(result1.data);
            console.log(result2.data.msg);
        }))

    </script>

</head>
<body>

</body>
</html>